package com.bhcj.telling.view.activity;


import android.content.Intent;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.bhcj.telling.R;
import com.bhcj.telling.view.adapter.GuaAdapter;
import com.bhcj.telling.view.layout.TitleLayout;
import com.bhcj.telling.utils.ConstantUtil;
import com.bhcj.telling.utils.GuaUtil;
import com.bhcj.telling.model.bean.GuaWords;

import java.util.ArrayList;
import java.util.List;

public class ExplainActivity extends BaseActivity {

    private TitleLayout titleLayout;
    private LinearLayout contentPanel;
    private TextView titleView;
    private TextView explainView;
    private TextView xyView;
    private TextView jgView;
    private ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_explain);
        Intent intent = getIntent();
        String guaIdentify = intent.getStringExtra(ConstantUtil.GUA_IDENTIFY);
        GuaWords words = GuaUtil.getGuaWords(getAssets(),guaIdentify);

        titleLayout = findViewById(R.id.title);
        titleLayout.setTitle(words.getName());

        titleView = findViewById(R.id.titleView);
        titleView.setText(words.getFullTitle());

        explainView = findViewById(R.id.explain);
        explainView.setText(words.getAllExplain());

        xyView = findViewById(R.id.xiangyue);
        xyView.setText(words.getxYue());

        jgView = findViewById(R.id.jgView);
        jgView.setText(words.getDsExplain());

        listView = findViewById(R.id.listView);
        List<GuaWords.Entity> list = new ArrayList<>();
        list.addAll(words.getExplainList());
        list.addAll(words.getJgList());
        GuaAdapter guaAdapter = new GuaAdapter(ExplainActivity.this,android.R.layout.simple_list_item_1,list);
        listView.setAdapter(guaAdapter);

    }


}